@extends('layouts.app')

@section('content')
	{{--<div data-options="region:'center'"  class="easy_center">
		<div id="tt" class="easyui-tabs" style="width:100%;" data-options="border:false,fit:true,plain:true">
			<div title="首页"></div>
		</div>
	</div>--}}
	<div class="main-content">
		<div class="search_inp">
			<table width="100%" border="1" class="table_search">
				<thead>
					<tr>
						<th colspan="6">
							<span>查询条件</span>
						</th>
					</tr>
				</thead>
				<tbody>
				<tr>
					<td width="13.33%" align="right"><label>重点级别：</label></td>
					<td width="20%">
						<select name="jibie" class="w150">
							<option value="">请选择重点级别</option>
							<option value="10">省级重点单位</option>
							<option value="20">市级重点单位</option>
							<option value="30">县区级重点单位</option>
							<option value="40">一般单位</option>
						</select>
					</td>
					<td width="13.33%" align="right"><label>企业类型：</label></td>
					<td width="20%">
						<select name="type" class="w150">
							<option value="">请选择企业类型</option>
							@foreach($type as $v)
								<option value="{{$v->id}}">{{$v->name}}</option>
							@endforeach
						</select>
					</td>
					<td width="13.33%" align="right"><label>企业性质：</label></td>
					<td width="20%">
						<select name="xingzhi" class="w150">
							<option value="">请选择企业性质</option>
							<option value="10">国有</option>
							<option value="20">民营</option>
							<option value="30">股份</option>
							<option value="40">合资</option>
							<option value="50">外资</option>
							<option value="60">个体</option>
							{{--@foreach($type as $v)

                                <option value="{{$v->id}}">{{$v->name}}</option>
                            @endforeach--}}
						</select>
					</td>
				</tr>
				<tr>
					<td width="13.33%" align="right"><label>企业状态：</label></td>
					<td width="20%">
						<select name="is_del" class="w150">
							<option value="">请选择企业状态</option>
							<option value="0">实有</option>
							<option value="1">注销</option>
							<option value="2">合并</option>
						</select>
					</td>
					<td width="13.33%" align="right"><label>单位名称：</label></td>
					<td width="20%"><input type="text" class="" name="name" placeholder="请输入单位关键字"/></td>
					<td width="13.33%" align="right"></td>
					<td width="20%">
						<input type="hidden" name="map_id" value=""/>
						<input type="hidden" name="city" value=""/>
						<input type="hidden" name="area" value=""/>
						<input type="hidden" name="org_id" value=""/>
						<a href="javascript:" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width:80px;margin-left: 70px" onclick="doSearch()">查询</a>
					</td>
				</tr>
				</tbody>
			</table>
		</div>
		<div class="btn-toolbar list-toolbar">
			<div class="form-all mg_t30">
				<div id="tb">
					{{--@if(Auth::guard('admin')->user()->role_id != 22)
					<a class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="add()">新增</a>
					@endif--}}
					{{--<a class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="edit()">查看</a>--}}
					<a class="easyui-linkbutton" iconCls="icon-aj" plain="true" onclick="jump9()">添加安全检查</a>
				</div>
				<table id="dg" title="辖区单位列表" class="easyui-datagrid" style="width:100%;height:600px"
						data-options="rownumbers:true,singleSelect:true,pagination:true,pageSize:20,url:'{{url('admin/jiancha/index')}}',method:'get',toolbar:'#tb'">
					<thead>
						<tr>
							<th data-options="field:'city'" width="5%" align="center">市</th>
							<th data-options="field:'area'" width="10%" align="center">区</th>
							<th data-options="field:'org_id'" width="10%" align="center">所属派出所</th>
							<th data-options="field:'is_imp'" width="7%" align="center">重点级别</th>
							<th data-options="field:'type'" width="10%" align="center">企业类型</th>
							<th data-options="field:'xingzhi'" width="8%" align="center">企业性质</th>
							<th data-options="field:'name'" width="15%" align="center">单位名</th>
							<th data-options="field:'address'" width="15%" align="center">详细地址</th>
							<th data-options="field:'frdb_name'" width="10%" align="center">联系人</th>
							<th data-options="field:'frdb_phone'" width="11%" align="center">联系电话</th>
							{{--<th data-options="field:'id',formatter:formatAction" width="10%" align="center">操作</th>--}}
						</tr>
					</thead>
				</table>
		  </div>
		</div>
	</div>

	<!--新增-->
	<div id="w" class="easyui-window" closed="true" style="overflow-x: hidden;"></div>

	<script type="text/javascript">
		//搜索
		function doSearch(){
			$('#dg').datagrid('load',{
				city: $("input[name='city']").val(),
				area: $("input[name='area']").val(),
				org_id: $("input[name='org_id']").val(),
				name: $("input[name='name']").val(),
				type: $("select[name='type']").val(),
				xingzhi: $("select[name='xingzhi']").val(),
				is_del:$("select[name='is_del']").val(),
				jibie:$("select[name='jibie']").val(),
			});
		}
		function load_city_data_from_menu($id){
			$('#dg').datagrid('load',{
				city: $id,
			});
			$("input[name='city']").val($id);
			$("input[name='area']").val('');
			$("input[name='org_id']").val('');
			$("input[name='map_id']").val($id);

			$("select[name='jibie']").val(''),
			$("select[name='type']").val(''),
			$("select[name='xingzhi']").val(''),
			$("select[name='is_del']").val(''),
			$("input[name='name']").val('');
		}

		function load_area_data_from_menu($id){
			$('#dg').datagrid('load',{
				area: $id,
			});
			$("input[name='city']").val('');
			$("input[name='area']").val($id);
			$("input[name='org_id']").val('');
			$("input[name='map_id']").val($id);

			$("select[name='jibie']").val(''),
			$("select[name='type']").val(''),
			$("select[name='xingzhi']").val(''),
			$("select[name='is_del']").val(''),
			$("input[name='name']").val('');
		}
		function load_org_data_from_menu($id){
			$('#dg').datagrid('load',{
				org_id: $id,
			});
			$("input[name='city']").val('');
			$("input[name='area']").val('');
			$("input[name='org_id']").val($id);
			$("input[name='map_id']").val($id);

			$("select[name='jibie']").val(''),
			$("select[name='type']").val(''),
			$("select[name='xingzhi']").val(''),
			$("select[name='is_del']").val(''),
			$("input[name='name']").val('');
		}
	</script>
    <script src="{{ URL::asset('/') }}js/weizhi.js"></script>
	<script type="text/javascript">
		function add(){
			var shuz = fb1();
			$('#w').window({
				title: "新增",
				href: 'add',
				width:shuz[0],
				height:shuz[1],
                top:shuz[2],
                left:shuz[3],
				modal:true,
				closed: false,
				minimizable:false,
			});
		}
		function edit(){
			var shuz = fb1();
			$('#w').html('');
			var row = $('#dg').datagrid('getSelected');
			if (row) {
				var url = 'detail/'+row.id;
				$('#w').window({
					title: "查看",
					href: url,
					width:shuz[0],
					height:shuz[1],
	                top:shuz[2],
	                left:shuz[3],
					modal:true,
					closed: false,
					minimizable:false,
				});
			} else {
				$.messager.alert('提示','请选中要编辑的行！');
			}
		}

		//安全检查
		function jump9(){
			var shuz = fb1();
			var row = $('#dg').datagrid('getSelected');
			if (row) {
				var url = 'jiancha_list/'+row.id;
				$('#w').window({
					title: "安全检查",
					href: url,
					width:shuz[0],
					height:shuz[1],
	                top:shuz[2],
	                left:shuz[3],
					modal:true,
					closed: false,
					minimizable:false,
				});
			} else {
				$.messager.alert('提示','请选中一条记录！');
			}
		}
		$("#dg").datagrid({
			onDblClickRow: function (index, row) {
				jump9();
			}
		});
	</script>

@stop
